var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
    })(e, t);
}, function(e, t) {
    function r() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype, 
    new r());
}), a = this && this.__decorate || function(e, t, r, o) {
    var n, i = arguments.length, s = i < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, r) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, r, o); else for (var c = e.length - 1; 0 <= c; c--) (n = e[c]) && (s = (i < 3 ? n(s) : 3 < i ? n(t, r, s) : n(t, r)) || s);
    return 3 < i && s && Object.defineProperty(t, r, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameData"), s = e("UIManager"), c = e("Global"), l = e("TimeView"), d = cc._decorator, u = d.ccclass, p = d.property, h = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.timeView = null, e;
    }
    return i(e, t), e.prototype.onEnable = function() {
        cc.systemEvent.on("refresh_tryTime", this.refresh, this), this.timeView.node.on("finished", this.doEnd, this), 
        this.refresh();
    }, e.prototype.onDisable = function() {
        cc.systemEvent.off("refresh_tryTime", this.refresh, this), this.timeView.node.off("finished", this.doEnd, this);
    }, e.prototype.start = function() {}, e.prototype.refresh = function() {
        var e, t;
        -1 < c.G.tryPersonIdx && c.G.tryPersonMap.has(c.G.tryPersonIdx) && (r.GD.personIdx == c.G.tryPersonIdx || 99 - r.GD.personIdx == c.G.tryPersonIdx) ? (e = Date.now()) < (t = c.G.tryPersonMap.get(c.G.tryPersonIdx).time) ? (this.timeView.node.active = !0, 
        this.timeView.init(Math.floor((t - e) / 1e3)), this.timeView.startTimer()) : this.doEnd() : this.timeView.node.active = !1;
    }, e.prototype.doEnd = function() {
        this.timeView.node.active = !1, this.timeView.endTimer(), r.GD.personIdx = r.GD.lastPersonIdx, 
        c.G.tryPersonIdx = -1, s.default.getInstance().getPnl("start").personView.init();
    }, a([ p(l.default) ], e.prototype, "timeView", void 0), a([ u ], e);
}(cc.Component);

n.default = h;